package com.zabra.zl.ui.entrust;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.widget.LinearLayout;

import com.androidkun.xtablayout.XTabLayout;
import com.zabra.zl.R;
import com.zabra.zl.TabAdapter;
import com.zabra.zl.base.BaseActivity;
import com.zabra.zl.myview.NoSrcollViewPage;
import com.zabra.zl.ui.entrust.tab.day.TabDay;
import com.zabra.zl.ui.entrust.tab.history.TabHistory;
import com.zabra.zl.ui.godeal.tab.tab_choose.TabChoose;
import com.zabra.zl.ui.godeal.tab.tab_haved.TabHaved;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 委托查询
 */
public class EntrustActivity extends BaseActivity {

    @BindView(R.id.back)
    LinearLayout back;
    @BindView(R.id.tab)
    XTabLayout tab;
    @BindView(R.id.viewpager)
    NoSrcollViewPage viewpage;
    private List<String> titleList;
    private List<Fragment> fragmentList;
    private int orderId;
    @Override
    public int getLayoutId() {
        return R.layout.activity_entrust;
    }

    @Override
    public void initView() {
        orderId=getIntent().getExtras().getInt("orderid");
        titleList = new ArrayList<>();
        titleList.add("当日委托");
        titleList.add("历史委托");
        fragmentList = new ArrayList<>();
        fragmentList.add(new TabDay(orderId));
        fragmentList.add(new TabHistory(orderId));

        viewpage.setAdapter(new TabAdapter(this.getSupportFragmentManager(), titleList, fragmentList));
        viewpage.setOffscreenPageLimit(2);
        tab.setupWithViewPager(viewpage);
        tab.getTabAt(0).select();
        tab.getTabAt(1).select();
        viewpage.setCurrentItem(0);
    }

    @OnClick(R.id.back)
    public void onViewClicked() {
        finish();
    }
}
